<template>
  <div class="home-page">
    <!-- 欢迎区域 -->
    <div class="welcome-section">
      <div class="welcome-content">
        <h1 class="welcome-title">应急管理系统</h1>
        <p class="welcome-subtitle">为应急事件提供高效、智能的管理解决方案</p>

        <div class="welcome-stats">
          <div class="stat-item">
            <div class="stat-number">{{ stats.totalUsers }}</div>
            <div class="stat-label">注册用户</div>
          </div>
          <div class="stat-item">
            <div class="stat-number">{{ stats.totalArticles }}</div>
            <div class="stat-label">知识文章</div>
          </div>
          <div class="stat-item">
            <div class="stat-number">{{ stats.totalVolunteers }}</div>
            <div class="stat-label">志愿者</div>
          </div>
          <div class="stat-item">
            <div class="stat-number">{{ stats.activeEvents }}</div>
            <div class="stat-label">活跃事件</div>
          </div>
        </div>

        <div class="welcome-actions">
          <el-button
            type="primary"
            size="large"
            @click="goToLogin"
            v-if="!isLoggedIn"
          >
            立即登录
          </el-button>
        </div>
      </div>

      <div class="welcome-image">
        <div class="hero-image">
          <!-- 这里可以放应急管理的图标或图片 -->
          <div class="emergency-icon">
            <i
              class="el-icon-first-aid-kit"
              style="font-size: 120px; color: #409eff"
            ></i>
          </div>
        </div>
      </div>
    </div>

    <!-- 功能特色 -->
    <div class="features-section">
      <h2 class="section-title">核心功能</h2>
      <div class="features-grid">
        <div class="feature-card">
          <div class="feature-icon">
            <i class="el-icon-user"></i>
          </div>
          <h3>用户管理</h3>
          <p>完整的用户权限管理系统，支持角色分配和权限控制</p>
        </div>

        <div class="feature-card">
          <div class="feature-icon">
            <i class="el-icon-document"></i>
          </div>
          <h3>知识库</h3>
          <p>丰富的应急知识库，包含文章、视频和测试题库</p>
        </div>

        <div class="feature-card">
          <div class="feature-icon">
            <i class="el-icon-warning"></i>
          </div>
          <h3>事件管理</h3>
          <p>实时监控和处理应急事件，快速响应和处置</p>
        </div>

        <div class="feature-card">
          <div class="feature-icon">
            <i class="el-icon-s-custom"></i>
          </div>
          <h3>志愿者系统</h3>
          <p>志愿者招募和管理，技能匹配和任务分配</p>
        </div>

        <div class="feature-card">
          <div class="feature-icon">
            <i class="el-icon-bell"></i>
          </div>
          <h3>通知系统</h3>
          <p>智能通知系统，及时推送重要信息和提醒</p>
        </div>

        <div class="feature-card">
          <div class="feature-icon">
            <i class="el-icon-s-data"></i>
          </div>
          <h3>数据统计</h3>
          <p>全面的数据统计和分析，可视化图表展示</p>
        </div>
      </div>
    </div>

    <!-- 底部信息 -->
    <div class="footer-section">
      <div class="footer-content">
        <p>&copy; 2024 应急管理系统. All rights reserved.</p>
        <div class="footer-links">
          <a href="#">关于我们</a>
          <a href="#">联系方式</a>
          <a href="#">帮助中心</a>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
definePageMeta({
  layout: false,
});

const router = useRouter();
const isLoggedIn = computed(() => {
  return !!localStorage.getItem("auth_token");
});

// 统计数据
const stats = reactive({
  totalUsers: 1250,
  totalArticles: 68,
  totalVolunteers: 89,
  activeEvents: 5,
});

// 页面方法
const goToLogin = () => {
  router.push("/login");
};
</script>

<style scoped>
.home-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

/* 欢迎区域 */
.welcome-section {
  display: flex;
  align-items: center;
  min-height: 80vh;
  padding: 40px 20px;
  max-width: 1200px;
  margin: 0 auto;
}

.welcome-content {
  flex: 1;
  padding-right: 40px;
}

.welcome-title {
  font-size: 3.5rem;
  font-weight: bold;
  margin-bottom: 20px;
  background: linear-gradient(45deg, #fff, #f0f8ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.welcome-subtitle {
  font-size: 1.2rem;
  margin-bottom: 40px;
  opacity: 0.9;
  line-height: 1.6;
}

.welcome-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.stat-item {
  text-align: center;
  padding: 20px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  backdrop-filter: blur(10px);
}

.stat-number {
  font-size: 2.5rem;
  font-weight: bold;
  margin-bottom: 5px;
}

.stat-label {
  font-size: 0.9rem;
  opacity: 0.8;
}

.welcome-actions {
  margin-top: 30px;
}

.welcome-image {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}

.hero-image {
  width: 400px;
  height: 400px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
}

.emergency-icon {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

/* 功能特色 */
.features-section,
.quick-access-section {
  padding: 80px 20px;
  max-width: 1200px;
  margin: 0 auto;
}

.section-title {
  text-align: center;
  font-size: 2.5rem;
  margin-bottom: 60px;
  font-weight: bold;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 30px;
}

.feature-card {
  background: rgba(255, 255, 255, 0.95);
  color: #333;
  padding: 30px;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.feature-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.feature-icon {
  font-size: 3rem;
  color: #409eff;
  margin-bottom: 20px;
}

.feature-card h3 {
  font-size: 1.5rem;
  margin-bottom: 15px;
  color: #333;
}

.feature-card p {
  color: #666;
  line-height: 1.6;
}

/* 快速入口 */
.quick-access-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
}

.quick-access-card {
  cursor: pointer;
  transition: all 0.3s ease;
}

.quick-access-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.access-icon {
  font-size: 2rem;
  color: #409eff;
  margin-bottom: 15px;
  text-align: center;
}

.access-title {
  font-size: 1.2rem;
  font-weight: bold;
  margin-bottom: 8px;
  text-align: center;
}

.access-desc {
  color: #666;
  text-align: center;
  font-size: 0.9rem;
}

/* 底部信息 */
.footer-section {
  background: rgba(0, 0, 0, 0.2);
  padding: 40px 20px;
  margin-top: 60px;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-links {
  display: flex;
  gap: 20px;
}

.footer-links a {
  color: white;
  text-decoration: none;
  opacity: 0.8;
  transition: opacity 0.3s ease;
}

.footer-links a:hover {
  opacity: 1;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .welcome-section {
    flex-direction: column;
    text-align: center;
    padding: 20px;
  }

  .welcome-content {
    padding-right: 0;
    margin-bottom: 40px;
  }

  .welcome-title {
    font-size: 2.5rem;
  }

  .welcome-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .features-grid {
    grid-template-columns: 1fr;
  }

  .quick-access-grid {
    grid-template-columns: 1fr;
  }

  .footer-content {
    flex-direction: column;
    gap: 20px;
  }

  .hero-image {
    width: 300px;
    height: 300px;
  }
}
</style>
